package br.com.marsso.sorte.client.ui;

import com.google.gwt.user.client.ui.RootPanel;

public class ContentContainer {
	private static ContentContainer instance = new ContentContainer();
	private static Content content;
	private static String rootWrapperId;

	private ContentContainer() {
	}

	public static ContentContainer getInstance() {

		if (instance == null) {

			instance = new ContentContainer();
		}

		return instance;
	}

	public static void setContent(Content content) {

		ContentContainer.content = content;

		RootPanel.get(ContentContainer.rootWrapperId).clear();
		RootPanel.get(ContentContainer.rootWrapperId).add(content);

	}

	public static void setContent(Content content, String rootWrapperId) {

		ContentContainer.content = content;
		ContentContainer.rootWrapperId = rootWrapperId;

		RootPanel.get(rootWrapperId).clear();
		RootPanel.get(rootWrapperId).add(content);

	}

	public static Content getContent()

	{
		return ContentContainer.content;
	}

	public static void setRoot(String rootWrapperId) {

		ContentContainer.rootWrapperId = rootWrapperId;
	}
}
